#include "03_header.h"

void gets_file(MYSQL *db,int netfd,char *Data,char *realPath){
    printf("开始传输文件\n");
    //                printf("%s\n",PATH);
//    memcpy(Data,tlv.data,length);
//    Data[length] = '\0';
    char query[1024];
    char real_pathname[256];
    sprintf(query,"select MD5 from file_info where filename = '%s';",Data);
    printf("%s\n",query);
    mysql_query(db,query);
    MYSQL_RES *ls_res = mysql_store_result(db);
    MYSQL_ROW ls_rows = mysql_fetch_row(ls_res);
    strcpy(real_pathname,realPath);
    strcat(real_pathname,ls_rows[0]);
    mysql_free_result(ls_res);
    printf("%s\n",real_pathname);
    transfile(netfd,real_pathname);
    printf("传输完成!\n");
    //close(netfd);
    //mysql_close(db);
//    break;

}
